<%--
  Created by IntelliJ IDEA.
  User: 18383
  Date: 2023/3/14
  Time: 10:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title></title>
    <link rel="stylesheet" href="static/plugins/bootstrap-3.4.1/css/bootstrap.min.css">
    <style>
        body {
            background-color: rgb(240, 240, 242);
        }

        th, td {
            text-align: center;
            font-size: 14px;
        }
        td:nth-child(1){
            text-align: left;
        }

        td > div {
            width: 45px;
            height: 45px;
            margin: 0 auto;
        }

        td > span {
            line-height: 45px;
        }

        td img {
            width: 100%;
            height: 100%;
        }
        td:nth-child(1){
            overflow: hidden;
            height: 45px;
            width: 270px;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        td>a, td>a:hover, td>a:focus {
            text-decoration: none;
            display: inline-block;
            width: 46px;
            height: 26px;
            margin-top: 10px;
        }

        .buy-now-btn {
            border-radius: 5px;
            outline: none;
            border: none;
        }

        .buy-now-btn, .buy-now-btn:hover, .buy-now-btn:focus {
            color: red;
            border: 1px solid red;
            background-color: #ffedee;
            outline: none;

        }
    </style>
</head>
<body>
<jsp:include page="layout/nav.jsp"></jsp:include>
<div class="container">
    <table class="table table-hover">
        <thead>
        <tr>
            <th>商品信息</th>
            <th>单价</th>
            <th>数量</th>
            <th>金额</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <c:if test="${empty requestScope.cart_list}">
            <tr>
                <td colspan="5" class="text-muted" style="font-size: 16px;text-align: center;line-height: 50px;">当前购物车还没有商品 ~ ~ ~ </td>
            </tr>
        </c:if>
        <c:forEach items='${requestScope.cart_list}' var="cart" varStatus="loop">
            <tr>
                <td class="clearfix">
                    <div style="float: left; margin-right: 15px">
                        <img src="${cart.cover}">
                    </div>
                    <span>${requestScope.book_name.get(loop.count-1)}</span>
                </td>
                <td><span>${cart.one_price}</span></td>
                <td><span>x${cart.count}</span></td>
                <td><span>${cart.all_price}</span></td>
                <td>
                    <a href="/order?m=userAddOrder&uid=${cart.user_id}&count=${cart.count}&one_price=${cart.one_price}&all_price=${cart.all_price}&book_id=${cart.book_id}&cart_id=${cart.id}" class="btn-sm buy-now-btn">下单</a>
                    <a href="/cart?m=deleteCart&cart_id=${cart.id}" class="btn-sm buy-now-btn">移出</a>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</div>

<script src="static/js/jquery-3.6.3.min.js"></script>
<script src="static/plugins/bootstrap-3.4.1/js/bootstrap.min.js"></script>
<script src="static/plugins/jqueryvalidate/jquery.validate.js"></script>
<script src="static/plugins/jqueryvalidate/messages_zh.js"></script>
<script src="static/js/jsEmail.js"></script>
<script src="static/js/registerForm.js"></script>

</body>
</html>
